<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>退货管理</title>
</head>
<body>
    <a href="/home/" class="button">返回</a>
    <h1>退货管理</h1>
    {% if messages %}
        <ul class="messages">
            {% for message in messages %}
                <li {% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
            {% endfor %}
        </ul>
    {% endif %}

    <form action="/requestreturn/" method="post">
        {% csrf_token %}
        <button type="submit" name="action" value="3">点击申请退货</button>
        <button type="submit" name="action" value="4">查询所有退货申请</button>
        <div class="container mt-5">
            <h2>退货申请</h2>
            <form action="/requestreturn/" method="post">
                {% csrf_token %}
                <div class="mb-3">
                    <label for="id_orderid" class="form-label">订单号</label>
                    {{ form.orderid.errors }}
                    {{ form.orderid }}
                    <label for="returnreason" class="form-label">退货原因</label>
                    {{ form.returnreason.errors }}
                    {{ form.returnreason }}
                </div>
            </form>
        </div>
        {% if requestreturns %}
        {% for requestreturn in requestreturns %}
            <p><strong>退货申请id:</strong> {{ requestreturn.returnid }}
            <strong>订单id:</strong> {{ requestreturn.orderid }}
            <strong>退货状态:</strong> {{ requestreturn.status }}
            <strong>申请退货时间:</strong> {{ requestreturn.time }}</p>
        {% endfor %}
        {% else %}
            <p>无退货处理</p>
        {% endif %}
    </form>
</body>
</html>

